//
//  Movie2ViewController.m
//  stotyboard豆瓣电影
//
//  Created by Zhao YanBin on 16/1/4.
//  Copyright © 2016年 panxue. All rights reserved.
//

#import "Movie2ViewController.h"
#import "NetworkHandler.h"
#import "movie2TableViewCell.h"
#import "movie2model.h"
#import "UIImageView+WebCache.h"
@interface Movie2ViewController ()<UITableViewDataSource,UITableViewDelegate>
@property (weak, nonatomic) IBOutlet UITableView *tableView;
@property(nonatomic, strong)NSMutableArray *dataArr;
@property (nonatomic , strong)NSMutableDictionary *dic;
@end

@implementation Movie2ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self data];
}

- (void)data
{
    NSString *str = @"http://project.lanou3g.com/teacher/yihuiyun/lanouproject/searchmovie.php?movieId=";
    NSString *newStr = [str stringByAppendingString:self.movieid];
    
    [NetworkHandler GETWithURL:newStr completion:^(id result) {
        
//        NSArray *arr = result[@"result"];
//        self.dataArr = [movie2model modelHanderWithArray:arr];
//        m = [movie2model modeWithDic:result[@"result"]];
        
        self.dic = result[@"result"];
        
        [_tableView reloadData];
    }];
    
    
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 1;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    movie2TableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
//    movie2model *m = _dataArr[indexPath.row];
//    cell.pingfen.text = m.rating;
//    cell.pinglun.text = m.rating_count;
//    cell.release_data.text = m.release_data;
//    cell.runtime.text = m.runtime;
//    cell.genres.text = m.genres;
//    cell.country.text = m.country;
//    cell.actors.text = m.actors;
//    cell.plot_simple.text = m.plot_simple;
    cell.pingfen.text = _dic[@"rating"];
    cell.pinglun.text = _dic[@"rating_count"];
    cell.release_data.text = _dic[@"release_date"];
    cell.runtime.text = _dic[@"runtime"];
    cell.genres.text = _dic[@"genres"];
    cell.country.text = _dic[@"country"];
    cell.actors.text = _dic[@"actors"];
    cell.plot_simple.text = _dic[@"plot_simple"];

    [cell.image sd_setImageWithURL:[NSURL URLWithString:_dic[@"poster"]]];
    
//    cell.pinglun.text = diccc[@"rating_count"];
//    cell.release_data.text = diccc[@"release_data"];
    return cell;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 1000;
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view contro ller.
}
*/

@end
